﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Box.Entities
{
    public partial class DetalleCompra:IEquatable<DetalleCompra>
    {
        //public Int32 Item { get; set; }

        public virtual Compra Compra { get; set; }
        public Int32 IdCompra { get; set; }

        public virtual Insumo Insumo { get; set; }
        public Int32 IdInsumo { get; set; }

        public int Cantidad { get; set; }
        public decimal PrecioUnit { get; set; }

        public bool Equals(DetalleCompra other)
        {
            if (object.ReferenceEquals(other, null)) return false;
            if (object.ReferenceEquals(this, other)) return true;

            return IdInsumo.Equals(other.IdInsumo) && IdCompra.Equals(other.IdCompra);
        }

        public override int GetHashCode()
        {
            return IdCompra.GetHashCode() * IdInsumo.GetHashCode();
        }


        public decimal Monto { get { return Cantidad * PrecioUnit; } }
    }
}
